import { post } from '../../common/http/http.service'

interface pageType {
    pageNo: number
    pageSize: number
    roleType?: 0 | 1
}

interface setRoleType {
    id: number
    roleName: string
    roleSex: number
    roleAge: number
    roleType: number
}

export interface roleTyle {
    createTime: string
    deleted: false
    icon: string
    id: string
    roleAge: string
    roleName: string
    roleSex: number
    roleType: number
    userId: string
}

/*
 * @Description: 角色模块请求
 * @Author: wujiajie
 */
export class RoleService {
    /**
     * 查询角色
     */
    getRolePage(param: pageType): Promise<any> {
        return post('/story/api/storyRole/page', param, { showLoading: false })
    }

    /**
     * 添加角色
     */
    saveStoryRole(param: setRoleType): Promise<any> {
        return post('/story/api/storyRole/save', param, { needIntercept: false })
    }

    /**
     * 修改角色
     */
    editStoryRole(param: setRoleType): Promise<any> {
        return post('/story/api/storyRole/edit', param)
    }

    /**
     * 删除角色
     */
    deleteStoryRole(id: string): Promise<any> {
        return post('/story/api/storyRole/delete', id)
    }
}
